
use super::model;

impl model::Article
{
    pub async fn update_by_id(rb: &mut dyn rbatis::executor::Executor, table: &Self, id: &str) -> rbatis::error::Result<rbatis::rbdc::db::ExecResult>
    {
        let id = rbs::to_value!(id);
        let title = rbs::to_value!(table.get_title());
        let sorts = rbs::to_value!(table.get_sorts());
        let tags = rbs::to_value!(table.get_tags());
        let value = vec![title, sorts, tags, id];
        let result = rb.exec(
            "UPDATE article SET title = ?, update_time = NOW(), sorts = ?, tags = ? WHERE id = ?",
            value
        ).await?;
        Ok(result)
    }
}


